package com.atcc.test.designmodel.proxy;

import java.lang.reflect.Proxy;

/**
 * 
 * 动态代理模式测试端
 * @author Administrator
 * 应用场景:需要提取横切关注点的产品，如给产品加日志和计算运行时间等。
 *
 */
public class Client {
	
	public static void main(String[] args) {
		Hello hello = new Entity();
		ProxyHandler proxyHandler = new ProxyHandler(hello);
		Hello realProxy = (Hello) Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), hello.getClass().getInterfaces(), proxyHandler);
		realProxy.sayHello();
		System.out.println(hello.getClass());
	}

}
